package stu.aistar.mapper;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Component;
import stu.aistar.model.pojo.Orders;

import java.util.List;

@Component
public interface OrdersMapper {
    Integer insertOrders(Orders orders);

    @Update("update orders set state='已完成' where orders_no=#{value}")
    Integer updateOrdersState(String ordersNo);

    List<Orders> findOrdersByConditions(String userName, String ordersNo, String state);

    @Select("select * from orders where user_id=#{value}")
    List<Orders> findOrdersByUserId(Integer userId);

    @Select("select * from orders where orders_no=#{value}")
    Orders findOrdersByOrdersNo(String ordersNo);
}
